package com.mall.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mall.db.domain.Config;
import com.mall.db.service.ConfigService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/mcc")
public class ConfigController extends BaseController<Config>{
    @Resource(name = "configService")
    private ConfigService cs;

    @Override
    public Map<String, Object> find(Config config) {
        QueryWrapper<Config> qw = new QueryWrapper<>();
        List<Config> list = cs.list(qw);
        return findMap(list,10);
    }

    @Override
    public Map<String, Object> update(Config config) {
        config.setId(1);
        config.setUpdateTime(new Date());
        boolean b = cs.updateById(config);
        return iud("保存",b,config);
    }
}
